package ai.peanut.one.api.tread.testbase;

import ai.peanut.one.api.tread.testbase.CallableThreadTest;
import ai.peanut.one.api.tread.testbase.MyRunnable;
import ai.peanut.one.api.tread.testbase.MyThread;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class Test {
    public static void main(String[] args){
        MyRunnable ru = new MyRunnable();
        ru.run();

        Thread re = new Thread(ru) ;
        re.start() ;
        System.out.println("zzzzzzzzzzzzzzzzzzzzzzz");
        MyThread th = new MyThread() ;
        th.start() ;


        System.out.println("vvvvvvvvvvvvvvvvvvvvvvvvvv") ;
        CallableThreadTest ctt = new CallableThreadTest();
        FutureTask<Integer> ft = new FutureTask<>(ctt);
        Thread task = new Thread(ft) ;
        task.start() ;

        System.out.println("cccccccccccccccccccccccccccccc") ;
        try
        {
            System.out.println("callable线程返回值："+ft.get());
        } catch (InterruptedException e)
        {
            e.printStackTrace();
        } catch (ExecutionException e)
        {
            e.printStackTrace();
        }

        System.out.println("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb") ;

    }
}
